<!DOCTYPE html>
<title>Test, a delay in playing the movie still results in an "ended" event.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<video></video>
<script>
async_test(function(t) {
    var video = document.querySelector("video");

    video.oncanplaythrough = t.step_func(function() {
        video.oncanplaythrough = null;
        assert_equals(video.currentTime, 0);
        video.currentTime = video.duration - 0.2;
    });

    video.onseeked = t.step_func(function () {
        setTimeout(function() {
            video.play();
        }, 400);
    });

    video.onended = t.step_func_done();
    video.src = "content/test.ogv";
});
</script>